package com.cbgolf.oa.manager;

import com.cbgolf.oa.util.TypeUtil;
import com.cbgolf.oa.util.Util;

/**
 * @author lq
 * @date 2018/4/12
 */

public class OrderManager {

  public static final String ORDER_CONFIRM = "orderCode";

  /**
   * 对应订单列表页面，筛选订单类型
   * all
   */
  public static final int ORDER_TYPE_ALL_INDEX = 0;
  /**
   * teetime 订场
   */
  public static final int ORDER_TYPE_TEETIME_INDEX = 1;
  /**
   * match 比赛
   */
  public static final int ORDER_TYPE_MATCH_INDEX = 2;
  /**
   * grou
   */
  public static final int ORDER_TYPE_GROUP_INDEX = 3;
  /**
   * hotel 酒店
   */
  public static final int ORDER_TYPE_HOTEL_INDEX = 4;
  /**
   * combo 住打组合
   */
  public static final int ORDER_TYPE_COMBO_INDEX = 5;


  /**
   * 获取当前订单状态 ，主要用于显示
   *
   * @param orderState 状态"全部"为空，其它状态对应数字（fuck)
   * @return 中文字符串
   */
  public static String getOrderState(String orderState) {
    if (Util.isNull(orderState)) {
      return "全部";
    }
    String state = "****null****";
    switch (TypeUtil.getInt(orderState)) {
      /**
       * 未支付
       */
      case ORDER_STATE_NO_PAY:
        state = "未支付";
        break;
      /**
       * 已支付
       */
      case ORDER_STATE_PAY_HAS:
        state = "已支付";
        break;
      /**
       * 已过期
       */
      case ORDER_STATE_OUT_DATE:
        state = "已过期";
        break;
      /**
       * 已改签
       */
      case ORDER_STATE_CHANGED:
        state = "已改签";
        break;
      /**
       * 已完成
       */
      case ORDER_STATE_OVERD:
        state = "已完成";
        break;
      /**
       * 已退订
       */
      case ORDER_STATE_RETURNED:
        state = "已退订";
        break;
      /**
       * 已使用
       */
      case ORDER_STATE_USED:
        state = "已使用";
        break;
      /**
       * 已超时
       */
      case ORDER_STATE_TIME_OUT:
        state = "已超时";
        break;
      /**
       * 已取消
       */
      case ORDER_STATE_CANCELED:
        state = "已取消";
        break;
      /**
       * 已确认
       */
      case ORDER_STATE_CONFIRMED:
        state = "已确认";
        break;
      /**
       * 无效
       */
      case ORDER_STATE_WASTE:
        state = "无效";
        break;
      /**
       * 已创建
       */
      case ORDER_STATE_CREATED:
        state = "已创建";
        break;
      /**
       * 已创建
       */
      case ORDER_STATE_REJECTED:
        state = "已拒绝";
        break;
      default:
        break;
    }
    return state;

  }

  /**
   * 获取订单类型
   */
  public static String getOrderType(String type) {
    if (Util.isNull(type)) {
      return "全部";
    }
    String orderType = "****type*****";
    switch (type) {
      case ORDER_TYPE_TEETIME_REQUEST:
        orderType = "订场";
        break;
      case ORDER_TYPE_MATCH_REQUEST:
        orderType = "比赛";
        break;
      default:
        break;

    }
    return orderType;
  }

  /**
   * 获取订单类型
   */
  public static String getOrderDetailsType(String type) {
    if (Util.isNull(type)) {
      return "全部";
    }
    String orderType = "****type*****";
    switch (type) {
      case ORDER_TYPE_TEETIME_REQUEST:
        orderType = "订场";
        break;
      case ORDER_TYPE_MATCH_REQUEST:
        orderType = "比赛";
        break;
      default:
        break;

    }
    return orderType;
  }

  public static boolean isOrderTypeAll(String type) {
    return Util.isNull(type);
  }

  public static boolean isOrderStateAll(String state) {
    return Util.isNull(state);
  }
  /**
   * 订单类型
   * orderClassification
   */
  /**
   * 全部
   */
  public static final String ORDER_TYPE_ALL_REQUEST = "";
  /**
   * 订场
   */
  public static final String ORDER_TYPE_TEETIME_REQUEST = "ORDER";

  /**
   * 比赛
   */
  public static final String ORDER_TYPE_MATCH_REQUEST = "PLAY_ORDER";
  /**
   * 团队
   */
  public static final String ORDER_TYPE_GROUP_REQUEST = "GROUP_ORDER";
  /**
   * 酒店
   */
  public static final String ORDER_TYPE_HOTEL_REQUEST = "HOTEL_ORDER";
  /**
   * 住打套餐
   */
  public static final String ORDER_TYPE_LIVE_PLAY_REQUEST = "LIVE_TO_PLAY_ORDER";

  /**
   * 订单状态
   * orderState
   */
  /**
   * 全部
   */
  public static final String ORDER_STATE_ALL = "";
  /**
   * 未支付
   */
  public static final int ORDER_STATE_NO_PAY = 0;
  /**
   * 已支付
   */
  public static final int ORDER_STATE_PAY_HAS = 1;
  /**
   * 已过期
   */
  public static final int ORDER_STATE_OUT_DATE = 2;
  /**
   * 已改签
   */
  public static final int ORDER_STATE_CHANGED = 3;
  /**
   * 已完成
   */
  public static final int ORDER_STATE_OVERD = 4;
  /**
   * 已退订
   */
  public static final int ORDER_STATE_RETURNED = 5;
  /**
   * 已使用
   */
  public static final int ORDER_STATE_USED = 6;
  /**
   * 已超时
   */
  public static final int ORDER_STATE_TIME_OUT = 7;
  /**
   * 已取消
   */
  public static final int ORDER_STATE_CANCELED = 8;
  /**
   * 无效
   */
  public static final int ORDER_STATE_WASTE = 9;
  /**
   * 已创建
   */
  public static final int ORDER_STATE_CREATED = 10;
  /**
   * 已拒绝
   */
  public static final int ORDER_STATE_REJECTED = 11;
  /**
   * 已确认
   */
  public static final int ORDER_STATE_CONFIRMED = 12;
  /**
   * type zh
   */
  public static final String MATCH_TEXT_ZH = "比赛";
  public static final String HOTEL_TEXT_ZH = "酒店";
  public static final String COMBO_TEXT_ZH = "住打";
  public static final String GROUP_TEXT_ZH = "团队";
  /**
   * order state zh
   */
  public static final String HASPAY_TEXT_ZH = "已支付";
  public static final String NOPAY_TEXT_ZH = "未支付";
  public static final String WAIT_CONFIRM_TEXT_ZH = "待确认";

  //    /**
//     * orderType
//     */
//    public static final String ORDER_ALL = "";
//    public static final String ORDER_BOOK = "ORDER";
//    public static final String ORDER_MATCH = "PLAY_ORDER";
  public static final int LIVE_PLAY_NEARBY = 0;
  public static final int LIVE_PLAY_INLAND = 1;
  public static final int LIVE_PLAY_OVERSEAS = 2;

  public static boolean isGroupOrder(String orderType) {
    return Util.isEquals(orderType, ORDER_TYPE_GROUP_REQUEST);
  }
}
